package cn.tedu.oa_system.controller;

import cn.tedu.oa_system.base.json_result.ResultDataDto;
import cn.tedu.oa_system.base.json_result.ResultDto;
import cn.tedu.oa_system.pojo.NoteList;
import cn.tedu.oa_system.pojo.TypeList;
import cn.tedu.oa_system.pojo.in.AddNewNoteIn;
import cn.tedu.oa_system.pojo.in.NoteListIn;
import cn.tedu.oa_system.pojo.in.TypeListIn;
import cn.tedu.oa_system.service.NoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/note")
public class NoteController {

    @Autowired
    private NoteService noteService;

    @PostMapping("/list")
    public ResultDataDto<NoteList> list(@RequestBody NoteListIn noteListIn){
        return noteService.list(noteListIn);
    }

    @GetMapping("/typeList")
    public ResultDataDto<TypeList> typeList(){
        return noteService.typeList();
    }

    @PostMapping("/addNewNoteType")
    public ResultDto<Void> addNewNoteType(@RequestBody TypeListIn typeListIn){
        return noteService.addNewNoteType(typeListIn);
    }

    @PostMapping("/addNewNote")
    private ResultDto<Void> addNewNote(@RequestBody AddNewNoteIn addNewNoteIn){
        return noteService.addNewNote(addNewNoteIn);
    }

}
